package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type Mysql struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}
type Redis struct {
	Host     string
	Port     int
	Password string
	Database int
}
type AddConfig struct {
	Mysql
	Redis
}

var Config AddConfig

func Init() {
	viper.SetConfigFile("appconfig/dev.yaml")
	viper.ReadInConfig()
	err := viper.Unmarshal(&Config)
	if err != nil {
		panic(err)
	}
	fmt.Println("动态文件加载", Config)

}
